package com.my.basic.switchs;

/**
 * @author: marshal
 * @date: 2021-08-26 3:36 PM
 */
public class SwitchTest {
    public static void main(String[] args) {
//        var i = (int) (Math.random() * 4);
//        System.out.println("i = " + i + ",getS(i) = " + getS(i));;
//        System.out.println(formatterPatternSwitch(10.f));
    }

    private static String getS(int i) {
        var x = switch (i) {
            case 1 -> "one";
            case 2 -> "two";
            case 3 -> "three";
            default -> "zero";
        };
        return x;
    }

//    private static String formatterPatternSwitch(Object o) {
//        return switch (o) {
//            case Integer i -> String.format("int %d", i);
//            case Long l    -> String.format("long %d", l);
//            case Double d  -> String.format("double %f", d);
//            case String s  -> String.format("String %s", s);
//            default        -> o.toString();
//        };
//    }
}
